<?php
class hasil_pemilihan_adik_asuh extends MY_Controller{
    var $data,
        $limit = 10;
    function hasil_pemilihan_adik_asuh(){
        parent::MY_Controller();
        $this->data['title'] = "Hasil Pemilihan Adik Asuh";
        $this->load->model('m_calon_adik_asuh');
        $this->load->model('m_kriteria');
        $this->load->model('m_tingkat_kepentingan_kriteria');
        $this->load->model('m_pemilihan_adik_asuh');
    }
    function index(){
        $this->get_pemilihan_adik_asuh('all',0);
    }
    function search(){
        $url = $this->input->post("url");
        $params = "awal_".date2mysql($this->input->post("awal"));
        $params .= "__akhir_".date2mysql($this->input->post("akhir"));
        redirect("$url/$params/0/");
    }
    function get_pemilihan_adik_asuh($params = 'all',$offset = 0){
        $option = parsing_param2($params);
        $this->data['content'] = "pemilihan_adik_asuh/info_pemilihan_adik_asuh";
        $this->data['formTitle'] = "Parameter Pencarian";
        $this->data['searchLink'] = "hasil_pemilihan_adik_asuh/get_pemilihan_adik_asuh";
        $uri_segment = 4;
        if($offset != 0){
          $offset = $this->uri->segment($uri_segment);  
        }
        $num_rows = $this->m_pemilihan_adik_asuh->getCountRows($option);
        $this->data['listPemilihanAdikAsuh'] = $this->m_pemilihan_adik_asuh->getPemilihanAdikAsuh($offset,$this->limit,$option);
        $config['base_url'] = site_url("hasil_pemilihan_adik_asuh/get_pemilihan_adik_asuh")."/".$params;
        $config['uri_segment'] = $uri_segment;
        $config['total_rows'] = $num_rows;
        $config['per_page'] = $this->limit;
        $this->pagination->initialize($config);
        $this->data['pagination'] = $this->pagination->create_links();
        $this->data['offset'] = $offset;
        
        $this->render($this->data);
    }
    function detail_pemilihan_adik_asuh($id,$params){
        $this->data['content'] = 'pemilihan_adik_asuh/detail_pemilihan_adik_asuh';
        $this->data['formTitle'] = 'Detail Perangkingan Calon Adik Asuh';
        $this->data['linkBack'] = site_url("hasil_pemilihan_adik_asuh/get_pemilihan_adik_asuh/$params");
        $this->data['titlePage'] = 'Detail Pemilihan Adik Asuh';
        $this->data['prevPage'] = 'Hasil Pemilihan Adik asuh';
        $this->data['alternatif'] = $this->m_pemilihan_adik_asuh->getAlternatif($id);
        $this->data['kriteria'] = $this->m_pemilihan_adik_asuh->getKriteria($id);
        $this->data['bobot'] = $this->m_pemilihan_adik_asuh->getBobot($id);
        $this->data['matrikKeputusan'] = $this->m_pemilihan_adik_asuh->getMatrikKeputusan($id);
        $this->data['hasilPemilihanAdikAsuh'] = $this->m_pemilihan_adik_asuh->getListHasilPemilihan($id);
        
        $this->render($this->data);
    }
}
?>
